<?php

/**
 * 上传单张图片--返回的是Upload Image Path
 * @Author   zhanghong
 * @DateTime 2016-05-04
 * @param    string     $backcall 回调字段名
 * @param    integer    $width    图片高度
 * @param    integer    $height   图片宽度
 * @param    string     $image    当前图片路径
 * @param    string     $backcall_name    回调字段ID
 * @param    string     $upload_type    上传文件类型
 */
function create_upload_image($backcall="image", $width=100, $height=100, $image="", $backcall_name="", $upload_type = 'image'){
    if(empty($backcall_name)){
      $backcall_name = $backcall;
    }
    echo '<iframe scrolling="no" frameborder="0" border="0" onload="this.height=this.contentWindow.document.body.scrollHeight;this.width=this.contentWindow.document.body.scrollWidth;" width='.$width.' height="'.$height.'"  src="'.url('admin/upload/create').'?width='.$width.'&height='.$height.'&backcall='.$backcall.'&image='.$image.'&backcall_name='.$backcall_name.'&upload_type='.$upload_type.'"></iframe>
         <input type="hidden" name="'.$backcall_name.'" id="'.$backcall.'">';
}

/**
 * 上传单张图片--返回的是Upload Item ID
 * @Author   zhanghong
 * @DateTime 2016-05-04
 * @param    string     $backcall 回调字段名
 * @param    integer    $width    图片高度
 * @param    integer    $height   图片宽度
 * @param    string     $id       当前关联图片ID
 * @param    string     $backcall_name    回调字段ID
 * @param    string     $upload_type    上传文件类型
 */
function add_upload_image($backcall="image", $width=100, $height=100, $id="", $backcall_name="", $upload_type = 'image'){
    if(empty($backcall_name)){
      $backcall_name = $backcall;
    }
    echo '<iframe scrolling="no" frameborder="0" border="0" onload="this.height=this.contentWindow.document.body.scrollHeight;this.width=this.contentWindow.document.body.scrollWidth;" width='.$width.' height="'.$height.'"  src="'.url('admin/upload/add').'?width='.$width.'&height='.$height.'&backcall='.$backcall.'&id='.$id.'&backcall_name='.$backcall_name.'&upload_type='.$upload_type.'"></iframe>
         <input type="hidden" name="'.$backcall_name.'" id="'.$backcall.'">';
}